home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 13 / 013.d81 / dos #36 < prev    next >
Text File  |  2022-08-26  |  4KB  |  173 lines

  1. ======================================
  2.  
  3.       DOS & Don'ts -- Part 36
  4.  
  5.       by James Gregory Weiler
  6.  
  7. ======================================
  8.  
  9. ======================================
  10. Part 4: Directory blocks
  11. ======================================
  12.  
  13.  
  14.   Each directory block consists of two
  15.  
  16. parts:  the directory link in bytes 0
  17.  
  18. and 1, and the file directory section.
  19.  
  20.   The directory link gives the track
  21.  
  22. and block number of the block where
  23.  
  24. the directory continues.
  25.  
  26.   The file directory section, bytes 2
  27.  
  28. through 255, has storage space for
  29.  
  30. eight file names, each using thirty
  31.  
  32. bytes.  See map 4, below.  The disk
  33.  
  34. has 18 directory blocks, so you can
  35.  
  36. store 144 (18 X 8) files on a disk.
  37.  
  38.  
  39. ======================================
  40. Map 4: A single directory sector.
  41.  
  42.   byte/contents
  43. --------------------------------------
  44.      0/Track of next directory block.
  45.        Normally eighteen.
  46.  
  47.      1/Block number of the next
  48.        directory block.  It normally
  49.        equals this block plus three
  50.        (or this block minus 14 if
  51.        this block is greater than 15).
  52.  
  53.    2-31 / File name 1
  54.   34-63 / File name 2
  55.   66-95 / File name 3
  56.  98-127 / File name 4    (see Map 5)
  57. 130-159 / File name 5    (far below)
  58. 162-191 / File name 6
  59. 194-223 / File name 7
  60. 226-255 / File name 8
  61. ======================================
  62.  
  63. ======================================
  64. Part 5:directory file entries
  65. ======================================
  66.  
  67.   All of the 144 file name areas in
  68.  
  69. the directory share the same
  70.  
  71. structure.  See map 5, far below.
  72.  
  73.   The first of the thirty bytes (byte
  74.  
  75. zero) is the file type byte.
  76.  
  77. The value of this byte defines the
  78.  
  79. file type of this file entry.
  80.  
  81. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.  
  83. THE FILE TYPE BYTE:
  84.  
  85. byte   file
  86. value  type    typical file contents
  87. - - - - - - - - - - - - - - - - - - -
  88.     0  DEL     none -- file scratched
  89.   129  SEQ     text/data
  90.   130  PRG     program/text/ml/data
  91.   131  USR     text/data
  92.   132  REL     text/data
  93. 1-127   -      file not closed
  94.                properly
  95.  
  96. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  97.  
  98.   A file type byte with a value less
  99.  
  100. than 128 means that this file was not
  101.  
  102. properly closed.  When the disk is
  103.  
  104. validated, these "invalid" files will
  105.  
  106. disappear.
  107.  
  108.   Bytes one and two are the track and
  109.  
  110. block numbers of the first data block
  111.  
  112. of the file.
  113.  
  114.   Bytes three through eighteen contain
  115.  
  116. the file's name.  If the name is less
  117.  
  118. than sixteen bytes long, this area
  119.  
  120. will be padded with shifted spaces.
  121.  
  122.   Bytes nineteen and twenty are only
  123.  
  124. used by RELative files.  They point to
  125.  
  126. the file's first side sector.  Side
  127.  
  128. sectors keep track of where every part
  129.  
  130. of a relative file is so you can read
  131.  
  132. any record directly, without scanning
  133.  
  134. all the way through the file.
  135.  
  136.   Byte twenty-one, also used only for
  137.  
  138. relative files, is the record size.
  139.  
  140.   Bytes twenty-eight and twenty-nine
  141.  
  142. tell us the number of blocks in the
  143.  
  144. file.  The block count can be figured
  145.  
  146. by multiplying the contents of byte 29
  147.  
  148. by 256 and adding the results to the
  149.  
  150. contents of byte 28.
  151.  
  152. ======================================
  153. Map 5: A single directory entry.
  154.  
  155. byte       contents
  156. --------------------------------------
  157. 0     File type byte.
  158. 1     Track of first data block.
  159. 2     Block # of first data block.
  160. 3-18  File name followed by shifted
  161.       spaces.
  162. 19    Track of first side sector block
  163. 20    Block # of first side sector
  164.       block.
  165. 21    Record size.
  166. 22-25 Unused
  167. 26-27 Block of replacement file when
  168.       using save"@0:name" -- the save
  169.       and replace syntax.
  170. 28-29 Number of blocks in the file.
  171.  
  172. =======< continued in Part 37 >=======
  173.